# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=xed-intel
pkgver=1140.722cd238
pkgrel=1
pkgdesc='X86 encoder decoder.'
url='https://github.com/intelxed/xed'
arch=('x86_64' 'aarch64')
license=('Apache')
makedepends=('git' 'python')
source=("$pkgname::git+https://github.com/intelxed/xed.git"
        'git+https://github.com/intelxed/mbuild.git')
sha512sums=('SKIP'
            'SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

build() {
  cd $pkgname

  python mfile.py --shared install
}

package() {
  cd "xed-intel/kits/xed-install-base-$(date +%F)-lin-x86-64/"

  install -dm 750 "$pkgdir/usr/include"
  install -dm 750 "$pkgdir/usr/lib"

  cp -a include/xed "$pkgdir/usr/include/xed"
  cp -a include/xed "$pkgdir/usr/include/intel"
  install -Dm 755 -t "$pkgdir/usr/lib/" lib/*

  cd "$srcdir/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

